import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

// 定义一个类型 AddRouteRecordRaw 扩展 RouteRecordRaw
export type AddRouteRecordRaw = RouteRecordRaw & {
  hidden?: boolean
}

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      component: () => import('../views/Home.vue'),
      hidden: false,
      meta: {
        title: '待办列表',
        icon: 'el-icon-document'
      }
    },
    {
      path: '/add',
      component: () => import('../views/Add.vue')
    },
    {
      path: '/api',
      component: () => import('../views/Api.vue')
    }
  ] as AddRouteRecordRaw[] // 使用我们自定义的类别
})

export default router
